import os

folder_path = "C:\\Users\\Administrator\\Desktop\\ultralytics-yolo11-main\\mydataset\\labels\\train"

prefixes = ['1273','1299','1303','1310','1325','1326','1612','1613','1648','1650','1653','1654','1656','1658','1688','1719','1720','3722','3893','3894','3897','3907','4016','4093','4172']

# 遍历文件夹中的所有文件
for filename in os.listdir(folder_path):
    # 检查文件名是否以列表中的某个前缀开头
    if any(filename.startswith(prefix) for prefix in prefixes):
        file_path = os.path.join(folder_path, filename)
        os.remove(file_path)
        print(f"已删除: {file_path}")